using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
    /// <summary> 
    ///Author: nnamthach@gmail.com 
    /// <summary>

    public class TVC_CATE2Info
    {
        #region Local Variable
        public class Field
        {
            public const string maingroup = "maingroup",
                mainname = "mainname";
        }
        private String _db;
        private String _maingroup;
        private String _mainname;

        public String db { get { return _db; } set { _db = value; } }
        public String maingroup { get { return _maingroup; } set { _maingroup = value; } }
        public String mainname { get { return _mainname; } set { _mainname = value; } }

        #endregion LocalVariable

        #region Constructor
        public TVC_CATE2Info()
        {
            _maingroup = "";
            _mainname = "";
        }
        public TVC_CATE2Info(
        String maingroup,
        String mainname
        )
        {
            _maingroup = maingroup;
            _mainname = mainname;
        }
        public TVC_CATE2Info(DataRow dr)
        {
            if (dr != null)
            {
                _maingroup = dr[Field.maingroup.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.maingroup.ToString()]);
                _mainname = dr[Field.mainname.ToString()] == DBNull.Value ? "" : Convert.ToString(dr[Field.mainname.ToString()]);
            }
        }
        public TVC_CATE2Info(DataRowView dr)
            : this(dr.Row)
        {

        }
        public TVC_CATE2Info(TVC_CATE2Info objEntr)
        {
            _maingroup = objEntr.maingroup;
            _mainname = objEntr.mainname;
        }
        #endregion Constructor

        #region InitTable
        public static DataTable ToDataTable()
        {
            DataTable dt = new DataTable("TVC_CATE2PRV");
            dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.maingroup.ToString(), typeof(String)),
				new DataColumn(Field.mainname.ToString(), typeof(String))
			});
            return dt;
        }
        public DataRow ToDataRow(DataTable dt)
        {
            DataRow row = dt.NewRow();
            row[Field.maingroup.ToString()] = _maingroup;
            row[Field.mainname.ToString()] = _mainname;
            return row;
        }
        #endregion InitTable
    }
}
